<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core" 
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
	xmlns:chart="http://sourceforge.net/projects/jsf-comp"
	xmlns:t="https://code.google.com/p/rad-framework/taglib"
	xmlns:tt="https://code.google.com/p/rad-framework"
	xmlns:s="http://jboss.com/products/seam/taglib" template="#{theme.layout}">
	
	<ui:param name="title" value="Dashboard"/>
	
	<!-- 
	dnd + dashboard component
	edit portlet + properties???
	poll
	-->
	
	<ui:define name="crumbs">
		<ui:remove>
			<h:form>
				<table width="100%">
					<tr>
						<td align="right">
							<a4j:commandLink value="Add" title="Add New Tab"/>
							<h:outputText value=" | "/>
							<a4j:commandLink value="Edit" title="Edit Current Tab"/>
							<h:outputText value=" | "/>
							<a4j:commandLink value="Delete"
								title="Delete Current Tab"/>
						</td>
					</tr>
				</table>
			</h:form>
		</ui:remove>
	</ui:define>
	
	<ui:define name="body">
		
		<rich:dragIndicator id="indicator"/>
		
		<div id="rad-framework-content-all">
			<rich:panel>
				<a4j:form>
					<rich:tabPanel switchType="ajax" headerAlignment="left">
					
					<c:forEach items="#{dashboard.tabs}" var="tab">
						<rich:tab name="#{tab.name}" label="#{tab.label}" id="#{tab.name}"
							rendered="#{tab.rendered}" disabled="#{tab.disabled}">
							<table cellpadding="10" cellspacing="10" width="100%">
						<c:forEach items="#{tab.rows}" var="row">
								<tr>
							<c:forEach items="#{row.panels}" var="panel">
									<td width="#{panel.width}" valign="top" colspan="#{panel.colspan}"
									rowspan="#{panel.rowspan}">
										<tt:toggle-panel rendered="true" switchType="client"
											id="#{panel.name}" opened="true"
											label="#{panel.label}">
											
											<ui:include src="#{panel.facelet}">
											</ui:include>
											
										</tt:toggle-panel>
									</td>
							</c:forEach>
								</tr>
						</c:forEach>
							</table>
						</rich:tab>
	
					</c:forEach>
					
<!--					
						<rich:tab name="o" label="Overview" id="tab1">
							
							<ui:remove>
								<rich:dragSupport dragIndicator=":indicator"
									dragType="Tab" dragValue="1">
									<rich:dndParam name="label" value="Tab 1"/>
								</rich:dragSupport>
								<rich:dropSupport acceptedTypes="Tab"
									dropValue="tab1" reRender="tab1">
								</rich:dropSupport>
							</ui:remove>
							<table cellpadding="10" cellspacing="10" width="100%">
								<tr>
									<td width="46%" rowspan="2" colspan="2" valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p11" opened="true"
											label="Some Charts">
											
											<rich:dragSupport
												dragIndicator=":indicator"
												dragType="Portlet"
												dragValue="p1">
												<rich:dndParam name="label"
													value="Portlet 1"/>
											</rich:dragSupport>
											<rich:dropSupport
												acceptedTypes="Portlet"
												dropValue="p1" reRender="tab1">
											</rich:dropSupport>
											
										</tt:toggle-panel>
									</td>
									<td width="33%" valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p211" opened="true"
											label="#{messages['Task']} #{messages['TaskStatusChart']}">
											
											<rich:dropSupport
												acceptedTypes="Portlet"
												dropValue="p2" reRender="tab1">
											</rich:dropSupport>
											
											<s:graphicImage id="statusPieChart"
												value="#{taskFinder.statusPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
									</td>
									<td width="10%" valign="top" rowspan="4">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p21" opened="true"
											label="Portlet 21"> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> Hi...
											<br/> </tt:toggle-panel>
									</td>
								</tr>
								<tr>
									<td valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p31" opened="true"
											label="#{messages['Task']} #{messages['TaskPriorityChart']}">
											<rich:dropSupport
												acceptedTypes="Portlett"
												dropValue="p1" reRender="tab1">
											</rich:dropSupport>
											
											<s:graphicImage id="priorityPieChart"
												value="#{taskFinder.priorityPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
									</td>
								</tr>
								<tr>
									<td valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p41" opened="true"
											label="More Charts">
											
										</tt:toggle-panel>
									</td>
									<td valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p42" opened="true"
											label="More Charts">
											
										</tt:toggle-panel>
									</td>
									<td valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p43" opened="true"
											label="More Charts">
											
										</tt:toggle-panel>
									</td>
								</tr>
								<tr>
									<td valign="top" colspan="3">
										<tt:toggle-panel rendered="true" switchType="client"
											id="p444" opened="true"
											label="More Charts">
											
										</tt:toggle-panel>
									</td>
								</tr>
							</table>
						</rich:tab>
						
						<rich:tab name="taskTab" label="Task Charts">
							<table cellpadding="10" cellspacing="10" width="100%">
								<tr>
									<td width="50%" valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk1" opened="true"
											label="By Name">
											
											<s:graphicImage
												value="#{taskFinder.namePieChart.getData(500,300)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk3" opened="true"
											label="By Description">
											
											<s:graphicImage
												value="#{taskFinder.descriptionPieChart.getData(400,300)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk7" opened="true"
											label="By Outcome">
											
											<s:graphicImage
												value="#{taskFinder.outcomePieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk5" opened="true"
											label="By View">
											
											<s:graphicImage
												value="#{taskFinder.urlPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk6" opened="true"
											label="By Process">
											
											<s:graphicImage
												value="#{taskFinder.processPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk8" opened="true"
											label="By Artifact">
											
											<s:graphicImage
												value="#{taskFinder.artifactIdPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
									</td>
									<td width="50%" valign="top" colspan="2">
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk2" opened="true"
											label="By User">
											
											<s:graphicImage
												value="#{taskFinder.userPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="tk4" opened="true"
											label="By Group">
											
											<s:graphicImage
												value="#{taskFinder.groupPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
									</td>
								</tr>
							</table>
						</rich:tab>
						
						<rich:tab name="eventTab" label="Event Charts">
							<table cellpadding="10" cellspacing="10" width="100%">
								<tr>
									<td width="100%" colspan="2" valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="ev6" opened="true" label="By Day">
											<s:graphicImage id="dayChart"
												value="#{eventFinder.dayChart.getData(1000,350)}"/>
											
										</tt:toggle-panel>
									</td>
								</tr>
								<tr>
									<td width="60%" valign="top">
										<tt:toggle-panel rendered="true" switchType="client"
											id="ev1" opened="true"
											label="By Name">
											
											<s:graphicImage id="namePieChart"
												value="#{eventFinder.namePieChart.getData(550,450)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="ev2" opened="true"
											label="By Source">
											<s:graphicImage id="sourcePieChart"
												value="#{eventFinder.sourcePieChart.getData(600,500)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="ev3" opened="true"
											label="By Process">
											<s:graphicImage id="processPieChart"
												value="#{eventFinder.processPieChart.getData(600,500)}"/>
											
										</tt:toggle-panel>
									</td>
									<td width="40%" valign="top" colspan="2">
										<tt:toggle-panel rendered="true" switchType="client"
											id="ev4" opened="true"
											label="By User">
											
											<s:graphicImage id="userIdPieChart"
												value="#{eventFinder.userIdPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
										<tt:toggle-panel rendered="true" switchType="client"
											id="ev5" opened="true"
											label="By Host">
											<s:graphicImage id="hostPieChart"
												value="#{eventFinder.hostPieChart.getData(350,250)}"/>
											
										</tt:toggle-panel>
									</td>
								</tr>
							</table>
						</rich:tab>
-->					
					</rich:tabPanel>
				</a4j:form>
			</rich:panel>
		</div>
	</ui:define>
	
</ui:composition>